Blockchain-based service execution method and apparatus, and electronic device

ABSTRACT

Appearance data of a target entity is collected as appearance data, where the target entity comprises a physical entity capable of accessing, as a member, a blockchain. The appearance data is registered in a distributed database associated with the blockchain as an identity of the target entity. A target transaction initiated by a member node device in the blockchain is received, where the target transaction comprises the appearance data of the target entity that is collected by the member node device and a service event that is related to the target entity and that is detected by the member node device. A smart contract that corresponds to the service event is invoked. Based on the identity indicated by the appearance data of the target entity, service logic stated in the smart contract is executed.

CROSS-REFERENCE TO RELATED APPLICATIONS

This application claims priority to Chinese Patent Application No. 201810277604.9, filed on Mar. 30, 2018, which is hereby incorporated by reference in its entirety.

TECHNICAL FIELD

One or more implementations of the present specification relate to the field of blockchain technologies, and in particular, to a blockchain-based service execution method and apparatus, and an electronic device.

BACKGROUND

Blockchain technology, also referred to as a distributed ledger technology, is a new technology in which one or more computing devices jointly participate in “accounting” and jointly maintain a complete distributed database. The blockchain technology has features of decentralization, openness, and transparency, each computing device can participate in database recording, and computing devices can rapidly perform data synchronization. Methods for establishing a decentralized system by using the blockchain technology and recording various execution programs for automatic execution in a distributed database of the blockchain have been widely applied to many fields.

SUMMARY

The present specification provides a blockchain-based service execution method, and the method includes: collecting appearance data of a target entity, and registering, in a distributed database of a blockchain, the appearance data as an identity of the target entity; receiving a target transaction initiated by a member node device in the blockchain, where the target transaction includes the appearance data of the target entity that is collected by the member node device and a service event that is related to the target entity and that is detected by the member node device; and invoking a smart contract that corresponds to the service event, and executing, based on the identity indicated by the appearance data of the target entity, service logic stated in the smart contract.

Optionally, an optical medium for solidifying the appearance data of the target entity is sprayed on an outer surface of the target entity; and the collecting appearance data of a target entity includes: collecting, by using a mounted optical sensor, the appearance data of the target entity that is solidified by a nano-optical film.

Optionally, the optical medium is the nano-optical film.

Optionally, the registering, in a distributed database of a blockchain, the appearance data as an identity of the target entity includes: storing the appearance data in the distributed database of the blockchain to form an association with the identity of the target entity that is registered in the blockchain.

Optionally, the method further includes: when the collected appearance data of the target entity changes, updating, based on changed appearance data, the appearance data that is registered in the distributed database of the blockchain, generating a corresponding update record, and storing the update record in the distributed database of the blockchain.

Optionally, the target entity includes a vehicle, and the member node device includes a public transport device that accesses the blockchain.

Optionally, the service event includes a vehicle violation event, and the service logic stated in the smart contract includes violation processing logic that corresponds to the vehicle violation event.

Optionally, the service event includes a vehicle accident event, and the service logic stated in the smart contract includes vehicle accident liability determining logic and vehicle accident settlement logic that correspond to the vehicle accident event.

Optionally, the service event includes a traffic congestion event, and the service logic stated in the smart contract includes right-of-way yielding logic that corresponds to the traffic congestion event.

Optionally, the service event includes a driving event of entering a planned road section by a vehicle, and the service logic stated in the smart contract includes reward logic that corresponds to the driving event of entering a planned road section by a vehicle.

Optionally, the service event includes a driving event of entering a planned road section by a vehicle, and the service logic stated in the smart contract includes service logic that corresponds to the driving event of entering a planned road section by a vehicle.

Optionally, the blockchain is a consortium blockchain.

The present specification further provides a blockchain-based service execution apparatus, and the apparatus includes: a registration module, configured to collect appearance data of a target entity, and register, in a distributed database of a blockchain, the appearance data as an identity of the target entity; a receiving module, configured to receive a target transaction initiated by a member node device in the blockchain, where the target transaction includes the appearance data of the target entity that is collected by the member node device and a service event that is related to the target entity and that is detected by the member node device; and an execution module, configured to invoke a smart contract that corresponds to the service event, and execute, based on the identity indicated by the appearance data of the target entity, service logic stated in the smart contract.

Optionally, an optical medium for solidifying the appearance data of the target entity is sprayed on an outer surface of the target entity; and the registration module is configured to: collect, by using a mounted optical sensor, the appearance data of the target entity that is solidified by the optical medium.

Optionally, the optical medium is a nano-optical film.

Optionally, the registration module is configured to: store the appearance data in the distributed database of the blockchain to form an association with the identity of the target entity that is registered in the blockchain.

Optionally, the apparatus further includes: an update module, configured to: when the collected appearance data of the target entity changes, update, based on changed appearance data, the appearance data that is registered in the distributed database of the blockchain, generate a corresponding update record, and store the update record in the distributed database of the blockchain.

Optionally, the target entity includes a vehicle, and the member node device includes a public transport device that accesses the blockchain.

Optionally, the service event includes a vehicle violation event, and the service logic stated in the smart contract includes violation processing logic that corresponds to the vehicle violation event.

Optionally, the service event includes a vehicle accident event, and the service logic stated in the smart contract includes vehicle accident liability determining logic and vehicle accident settlement logic that correspond to the vehicle accident event.

Optionally, the service event includes a traffic congestion event, and the service logic stated in the smart contract includes right-of-way yielding logic that corresponds to the traffic congestion event.

Optionally, the service event includes a driving event of entering a planned road section by a vehicle, and the service logic stated in the smart contract includes reward logic that corresponds to the driving event of entering a planned road section by a vehicle.

Optionally, the service event includes a driving event of entering a planned road section by a vehicle, and the service logic stated in the smart contract includes service logic that corresponds to the driving event of entering a planned road section by a vehicle.

Optionally, the blockchain is a consortium blockchain.

The present specification further provides an electronic device, and the electronic device includes: a processor; and a memory, configured to store a machine-executable instruction; where by reading and executing a machine-executable instruction that is stored in the memory and that corresponds to blockchain-based service execution control logic, the processor is enabled to: collect appearance data of a target entity, and register, in a distributed database of a blockchain, the appearance data as an identity of the target entity; receive a target transaction initiated by a member node device in the blockchain, where the target transaction includes the appearance data of the target entity that is collected by the member node device and a service event that is related to the target entity and that is detected by the member node device; and invoke a smart contract that corresponds to the service event, and execute, based on the identity indicated by the appearance data of the target entity, service logic stated in the smart contract.

BRIEF DESCRIPTION OF DRAWINGS

FIG. 1 is a flowchart illustrating a blockchain-based service execution method, according to an example implementation;

FIG. 2 is a schematic structural diagram illustrating an electronic device, according to an example implementation; and

FIG. 3 is a block diagram illustrating a blockchain-based service execution apparatus, according to an example implementation.

DESCRIPTION OF IMPLEMENTATIONS

The present specification provides a technical solution for registering, in a blockchain, appearance data of a target entity in the real world as an identity of the target entity, and triggering, in the blockchain based on the identity indicated by the appearance data of the target entity, execution of service interaction related to the identity of the target entity.

During implementation, when an operator of the blockchain needs to deploy, in the blockchain, a service related to the identity of the target entity, the operator of the blockchain can predefine a service event related to the target entity, deploy, in the blockchain, a smart contract that corresponds to the service event, and state, in the smart contract, service logic that corresponds to the service event and whose execution needs to be triggered based on the identity of the target entity.

In addition, a node device in the blockchain that is interconnected with the target entity can collect the appearance data of the target entity, and register, in a distributed database of the blockchain, the appearance data as the identity of the target entity.

In addition, after detecting the service event related to the target entity, a member node device (including the previous node device) in the blockchain can create a target transaction and publish the target transaction in the blockchain based on the collected appearance data and the detected service event, initiate contract invocation of the smart contract, and then execute, based on the identity indicated by the appearance data of the target entity, the service logic stated in the smart contract.

On the one hand, because the appearance data of the target entity is easy to collect, the appearance data of the target entity is registered in the distributed database of the blockchain as the identity of the target entity, so that after detecting the service event that corresponds to the target entity, the member node device in the blockchain can rapidly identify, by further collecting the appearance data of the target entity, the target entity that corresponds to the service event, to easily associate the service event with the identity of the target entity.

On the other hand, because the appearance data of the target entity is registered in the distributed database of the blockchain as the identity of the target entity, when creating the transaction based on the appearance data of the target entity and the service event and invoking the smart contract that is published in the blockchain and that corresponds to the service event, the member node device in the blockchain can execute, by using the identity indicated by the appearance data of the target entity, the service logic stated in the smart contract, to easily complete, in the blockchain, service interaction related to the identity of the target entity, thereby improving flexibility and extensibility of the blockchain from a service perspective.

The following describes the present specification by using specific implementations with reference to specific application scenarios.

FIG. 1 illustrates a blockchain-based service execution method, according to an implementation of the present specification. The method is applied to any node device in a blockchain, to perform the following steps:

Step 102: Collect appearance data of a target entity, and register, in a distributed database of a blockchain, the appearance data as an identity of the target entity.

Step 104: Receive a target transaction initiated by a member node device in the blockchain, where the target transaction includes the appearance data of the target entity that is collected by the member node device and a service event that is related to the target entity and that is detected by the member node device.

Step 106: Invoke a smart contract that corresponds to the service event, and execute, based on the identity indicated by the appearance data of the target entity, service logic stated in the smart contract.

The target entity can include any type of entity in the real world that can access the blockchain as a member.

For example, the target entity can include an entity such as a vehicle, a public transport device (for example, a traffic camera, traffic lights, or a smart zebra crosswalk), merchandise, or the like. In actual applications, these entities can be transformed into smart devices by disposing a chip, a sensor, or another form of smart hardware inside these entities, and access the blockchain as member devices.

Correspondingly, the blockchain described in the present specification can include any type of blockchain network that allows the target entity in the real world to access as a member.

For example, in a scenario, the target entity can be a vehicle, and the blockchain can be a consortium blockchain formed by member devices such as an operator service, a service server, one or more vehicles, and public transport devices such as a traffic camera, traffic lights, and a smart zebra crosswalk. An operator of the consortium blockchain can deploy, based on the consortium blockchain, online service interaction related to an identity of the vehicle, such as blockchain-based vehicle accident liability determining and vehicle accident settlement.

The service event may include any type of online service that is related to the identity of the target entity and that needs to be deployed and implemented by the operator of the blockchain in the blockchain.

Correspondingly, the service logic stated in the smart contract that corresponds to the service event may include any form of the described service logic whose execution needs to be triggered based on the identity of the target entity.

For example, in a scenario, the target entity is still a vehicle, the blockchain is a consortium blockchain formed by public transport devices that serve as member devices, for example, one or more vehicles, a traffic camera, traffic lights, and a smart zebra crosswalk, and the service event can include a “vehicle violation event”, a “vehicle accident event”, or a “traffic congestion event” that is related to the vehicle serving as a member device. In addition, service logic that corresponds to the service events and that is stated in the smart contract can include “violation processing logic that corresponds to the vehicle violation event”, “vehicle accident determining logic and vehicle accident settlement logic that corresponds to the vehicle accident event”, and “right-of-way yielding logic that corresponds to the traffic congestion event”.

The following describes in detail the technical solutions of the present specification by using an example in which the target entity is a vehicle and the blockchain is a consortium blockchain.

When the operator of the consortium blockchain needs to deploy, in the consortium blockchain and based on a specific architecture of the consortium blockchain, an online service whose execution needs to be triggered based on a real identity of the vehicle, the operator of the consortium blockchain can first predefine a service event related to the vehicle, develop a corresponding smart contract based on the described service event, and state, in the smart contract, service logic that corresponds to the service event and whose execution needs to be triggered.

For example, during implementation, the service event described by the operator can be used as an execution condition of the smart contract, and the smart contract can state program code (for example, some program methods or functions) that is related to the service logic and whose execution needs to be triggered when the execution condition of the smart contract is satisfied.

A specific type of the service event described by the operator and the service logic that corresponds to the service event usually both depend on an actual service need of the operator. Implementations are not limited in the present specification.

For a developed smart contract, the operator can publish the smart contract in the consortium blockchain by using any node device in the consortium blockchain, and the smart contract is recorded in the distributed database (namely, a distributed ledger) of the consortium blockchain after some designated member node devices (for example, one or more designated authoritative node devices in the consortium blockchain that have accounting privilege) in the consortium blockchain reach a consensus on the smart contract. Subsequently, a user can submit a transaction to the smart contract recorded in the blockchain by accessing client software of any node device, to initiate contract invocation of the smart contract and trigger execution of related service logic in the consortium blockchain.

It is worthwhile to note that, a consensus algorithm used when the member node device in the consortium blockchain performs consensus processing on the smart contract published in the blockchain and a specific consensus process are omitted in the present specification. A person skilled in the art can refer to records of related technologies when implementing the technical solutions recorded in the present specification.

In the present specification, the vehicle can be transformed into a smart transport device by embedding a chip, a sensor, or another form of smart hardware in the vehicle, and access the blockchain as a member device.

In a shown implementation, generation hardware (for example, a USB key) of a private key and a public key can be embedded in the vehicle, or a key algorithm used to generate a private key and a public key is added to a storage device of the vehicle. When accessing the consortium blockchain as a member device, the vehicle can first create a pair of a private key and a public key by using the mounted generation hardware of the private key and the public key or by invoking the included key algorithm.

Then, a transaction used to initiate registration can be further created, and after the transaction is signed based on the generated private key, the transaction is published in the consortium blockchain to apply to join the consortium blockchain. After receiving the transaction, some designated member node devices in the consortium blockchain can verify a signature of the transaction based on a public key that corresponds to the private key used when the transaction is signed, and can perform consensus processing on the transaction after the signature verification succeeds.

When a consensus on the transaction is reached, the public key of the vehicle can be calculated, and an account address is created for the vehicle in the consortium blockchain. In this case, the vehicle successfully joins the consortium blockchain as a member node device, and the account address generated for the vehicle is an identity of the member node device in the consortium blockchain.

In actual applications, because the account address created by the consortium blockchain for the vehicle after the vehicle joins the consortium blockchain is usually the identity of the vehicle in the consortium blockchain, if the operator of the consortium blockchain needs to perform, in the consortium blockchain, online deployment of some offline services whose execution needs to be triggered based on the real identity of the vehicle, the identity of the vehicle in the consortium blockchain cannot be easily associated with the deployed offline services.

For example, the offline services are an online vehicle accident liability determining service and an online vehicle accident settlement service that are to be completed in the consortium blockchain based on a detected vehicle violation event. After a member node device in the consortium blockchain detects that the vehicle commits a violation, because the member node device cannot learn of a real identity of the violating vehicle in the consortium blockchain, the member node device cannot associate the detected vehicle violation event with the real identity of the vehicle in the consortium blockchain, and cannot complete online service interaction, such as vehicle accident liability determining and vehicle accident settlement, based on the smart contract published in the consortium blockchain.

In the present specification, appearance data of the vehicle can be registered in a distributed database of the consortium blockchain as identity information of the vehicle in the consortium blockchain.

In a shown implementation, as a member node device, the vehicle can collect the appearance data of the vehicle by using a built-in chip, a built-in sensor, or another form of built-in intelligent hardware, and then store the collected appearance data in the distributed database of the consortium blockchain to form an association with the account address of the vehicle in the consortium blockchain, to register the appearance data of the vehicle as the identity information of the vehicle in addition to the owned identity of the vehicle in the consortium blockchain.

Certainly, if the vehicle does not have an account address as an identity in the consortium blockchain, the appearance data of the vehicle can be directly used as the identity of the vehicle in the consortium blockchain. For example, the appearance data of the vehicle serves as the public key of the vehicle, and the appearance data of the vehicle is calculated, to create an account address for the vehicle as the identity in the blockchain.

In a shown implementation, an optical medium for solidifying the appearance data of the vehicle can be pre-sprayed on an outer surface of the vehicle.

A specific material of the optical medium is not limited in the present specification, and includes, but is not limited to, any material that can be sprayed on the outer surface of the vehicle to solidify the appearance data of the vehicle.

For example, in an implementation, the optical medium can be a nano-optical film. The nano-optical film can be made of a nanoscale carbon-structured material. After being sprayed on the outer surface of the vehicle, the nanoscale carbon-structured material can wrap the entire vehicle to form a circuit, and the formed layer of nano-optical film can automatically solidify a shape of the vehicle.

In addition, the vehicle can be mounted with an optical sensor configured to collect the appearance data of the vehicle that is solidified by the nano-optical film, and optical sensing is performed on the nano-optical film by using the optical sensor, to collect the appearance data of the vehicle that is solidified by the nano-optical film.

Certainly, in addition to the previously shown implementation of solidifying and collecting the appearance data of the vehicle by spraying the optical medium on the vehicle, in actual applications, other methods may be used to collect the appearance data of the vehicle, which are not listed one by one in the present specification.

For example, three-dimensional scanning can be performed on the entire vehicle to precisely collect the appearance data of the vehicle; or an image of the vehicle is collected by using a visual technology, and the appearance data of the vehicle is generated through calculation based on the collected image.

In another shown implementation, when the collected appearance data of the vehicle changes, for example, when a vehicle accident occurs or another event that can change the shape of the vehicle happens, the appearance data registered in the distributed database of the consortium blockchain can be further updated based on the changed appearance data.

Further, during each update of the appearance data of the vehicle that is registered in the distributed database of the consortium blockchain, a corresponding update record can be further generated. For example, a transaction that includes the appearance data prior to the change and the changed appearance data is generated and published in the distributed database of the blockchain, and after a consensus on the transaction is reached, the transaction is recorded in the distributed database of the consortium blockchain.

In this method, in some service scenarios in which historical changes of the appearance data of the vehicle need to be invoked (for example, the historical changes of the appearance data of the vehicle are invoked to determine or evaluate damage of the vehicle), change data of the appearance data of the vehicle can be retrieved from the distributed database of the blockchain.

In the present specification, after the appearance data of the vehicle is registered in the distributed database of the consortium blockchain as the identity of the vehicle, if any member node device in the consortium blockchain detects a service event related to the vehicle, the member node device can publish the detected service event in the consortium blockchain in a form of transaction, and member node devices in the consortium blockchain that detect the service event perform consensus processing on the service event.

In the present specification, in the consortium blockchain, the consensus processing on the detected service event related to the vehicle is a process in which the node devices broadcast the detected service event by using the consortium blockchain, and make a joint decision on the service event based on “evidence” from the plurality of parties.

For example, the service event is a vehicle violation event, and the member node devices in the consortium blockchain include, for example, one or more vehicles, a traffic camera, traffic lights, and a smart zebra crosswalk. After a certain traffic camera serving as a member node device in the consortium blockchain detects that a certain vehicle commits a violation, the traffic camera can broadcast, in a form of transaction, the detected vehicle violation event to surrounding node devices in the consortium blockchain, and perform consensus processing on the transaction together with other surrounding member node devices that can also detect the violation event of the vehicle, such as other vehicles, a traffic light, and a smart zebra crosswalk. After a consensus is reached, it indicates that other surrounding node devices of the traffic camera can also detect that the vehicle commits a violation, the violation event of the vehicle that is detected by the traffic camera is reliable, and the plurality of parties jointly determine that the vehicle actually commits a violation.

In the present specification, after the consensus is reached on the service event detected by the member node device, the member node device can further collect the appearance data of the vehicle to determine the identity of the vehicle that corresponds to the service event.

For example, if the service event is a vehicle violation event, after detecting that the vehicle commits a violation, the member node device in the consortium blockchain can further sense, by using a mounted optical sensor, a nano-optical film sprayed on an outer surface of the vehicle, to collect appearance data of the vehicle that is solidified by the nano-optical film, thereby determining the identity of the currently violating vehicle in the consortium blockchain.

Further, the member node device in the consortium blockchain can create a transaction based on the detected service event and the collected appearance data of the vehicle, to initiate contract invocation of the smart contract that corresponds to the service event and that is deployed in the consortium blockchain, and trigger, in the consortium blockchain based on the real identity indicated by the appearance data of the vehicle, execution of service logic that corresponds to the service event and that is stated in the smart contract, thereby completing corresponding service interaction in the consortium blockchain.

For example, during implementation, the created transaction can include an account address of the smart contract, and then the transaction can be submitted to the smart contract as input of the smart contract based on the account address, to initiate invocation of the smart contract and trigger execution of program code that is stated in the smart contract and that is related to the service logic corresponding to the service event.

It is worthwhile to note that, when the member node device in the consortium blockchain creates a transaction for initiating invocation of the smart contract, the member node device can automatically create the transaction based on the detected service event and the collected appearance data of the vehicle, or the user can trigger creation of the transaction.

For example, if the user triggers creation of the transaction to initiate invocation of the smart contract, the vehicle can be mounted with voice interaction hardware, and a driver can trigger, by initiating a voice instruction to the vehicle, automatic creation of the transaction on the vehicle, to initiate invocation of the smart contract. If the service event is a traffic congestion event and the service logic stated in the smart contract is right-of-way yielding logic that corresponds to the traffic congestion event, the voice instruction can be a voice instruction “initiating a right-of-way yielding contract”.

Further, when invocation of the smart contract is completed, the member node device can also broadcast a prompt message to one or more surrounding node devices. After receiving the prompt message, the vehicle can play the prompt message for the driver in a voice or another form. If the service event is a vehicle violation event and the service logic stated in the smart contract is violation processing logic that corresponds to the vehicle violation event, the prompt message can be a prompt message “Driver of the vehicle with license plate No. XX committed a violation, and the smart contract has already helped you pay the fine”.

The following describes in detail the described technical solutions with reference to specific service scenarios.

In a shown implementation, the member node devices that form the consortium blockchain can include a server of the operator of the consortium blockchain, one or more third-party service servers, one or more vehicles, a traffic camera, traffic lights, a smart zebra crosswalk, etc.

The service server can be a server deployed by the operator based on an actual service need, or can be a third-party service server interconnected with the operator. If an online vehicle accident liability determining service and an online vehicle accident settlement service are to be completed in the consortium blockchain, the service server can be a service server of a third-party traffic management bureau or insurance company that is interconnected with the operator.

(1) Service Scenario 1

In a service scenario, an online service whose execution needs to be triggered based on the real identity of the vehicle and that is deployed in the consortium blockchain by the operator of the consortium blockchain can be an online violation processing service that is to be completed in the consortium blockchain based on a detected vehicle violation event.

In this scenario, the service event can be a “vehicle violation event” related to the vehicle. Correspondingly, service logic that corresponds to the service event and that is stated in the smart contract can be “violation processing logic that corresponds to the vehicle violation event”.

For example, the violation processing logic can be logic of taking punitive measures such as a fine and a penalty point based on a specific violation type of the vehicle.

Assume that the smart zebra crosswalk serving as a member node device detects that a vehicle commits a violation event “illegal parking on the zebra crosswalk”. The smart zebra crosswalk can broadcast, in the consortium blockchain, the violation event to surrounding member node devices of the smart zebra crosswalk, for example, other vehicles, the traffic camera, and the traffic lights, to perform consensus processing.

After a consensus is reached, the member node device can create a transaction based on the violation event and the collected appearance data of the vehicle, to initiate contract invocation of the smart contract (such as, a violation processing contract) that corresponds to the violation event and that is deployed in the consortium blockchain, and execute, in the consortium blockchain, the violation processing logic that corresponds to the violation event and that is stated in the smart contract, thereby completing punitive operations such as a fine and a penalty point in a stored account address associated with the appearance data of the vehicle.

After invocation of the smart contract is completed, the smart zebra crosswalk serving as a member node device can broadcast a prompt message “Driver of the vehicle with license plate No. XX committed a violation, and the smart contract has already helped you pay the fine” to the surrounding node devices, and the prompt message is played for the user by using the vehicle.

(2) Service Scenario 2

In another service scenario, online services whose execution needs to be triggered based on the real identity of the vehicle and that are deployed in the consortium blockchain by the operator of the consortium blockchain can be an online vehicle accident liability determining service and an online vehicle accident settlement service that are to be completed in the consortium blockchain based on a detected vehicle violation event.

In this scenario, the service event can be a “vehicle accident event” related to the vehicle. Correspondingly, service logic that corresponds to the service event and that is stated in the smart contract can be “vehicle accident liability determining logic and vehicle accident settlement logic that correspond to the vehicle accident event”.

For example, the vehicle accident liability determining logic and the vehicle accident settlement logic can be logic of determining vehicle accident liability and logic of executing settlement.

Assume that the vehicle serving as a member node device detects that a “rear-end collision” accident happens to the vehicle. The vehicle can broadcast, in the consortium blockchain, the vehicle accident event to surrounding member node devices of the vehicle, for example, another vehicle, the smart zebra crosswalk, the traffic camera, and the traffic lights, to perform consensus processing.

After a consensus is reached, the member node device can create a transaction based on the vehicle accident event and the collected appearance data of the vehicle, to initiate contract invocation of the smart contract (such as, a vehicle accident liability determining contract) that corresponds to the vehicle accident event and that is deployed in the consortium blockchain, and execute, in the consortium blockchain, the vehicle accident liability determining logic and the vehicle accident settlement logic that correspond to the vehicle accident event and that are stated in the smart contract, thereby completing an operation of determining vehicle accident liability and an operation of executing corresponding vehicle accident settlement.

After invocation of the smart contract is completed, the vehicle serving as a member node device can play a prompt message “Full liability is confirmed, and the insurance company has been informed of settlement payment” for the driver. Alternatively, in another implementation, the prompt message can be a prompt message “Full liability is confirmed, and the insurance company has been informed. Please determine whether to pay settlement”, and the driver can confirm payment in a form of a voice instruction.

(3) Service Scenario 3

In another service scenario, an online service whose execution needs to be triggered based on the real identity of the vehicle and that is deployed in the consortium blockchain by the operator of the consortium blockchain can be an online right-of-way yielding service that is to be completed in the consortium blockchain based on a detected traffic congestion event.

For example, after encountering vehicle congestion, a vehicle driver can actively yield right-of-way of the vehicle to a surrounding vehicle, to obtain a pass priority.

In this scenario, the service event can be a “traffic congestion event” related to the vehicle. Correspondingly, service logic that corresponds to the service event and that is stated in the smart contract can be “right-of-way yielding logic that corresponds to the traffic congestion event”.

In an example, the right-of-way yielding logic can be processing logic that a vehicle automatically obtains X minutes of right of way after the vehicle actively gives the way to a vehicle that initiates right-of-way yielding. Alternatively, the right-of-way yielding logic can be processing logic that a vehicle automatically obtains X minutes of right of way after the vehicle actively gives the way to a public transportation vehicle (for example, a bus).

In an implementation, assume that the vehicle serving as a member node device detects that a congestion event happens to the vehicle. The vehicle can broadcast, in the consortium blockchain, the vehicle accident event to surrounding member node devices of the vehicle, for example, another vehicle, the smart zebra crosswalk, the traffic camera, and the traffic lights, to perform consensus processing.

After a consensus is reached, the member node device can create a transaction based on the congestion event and the collected appearance data of the vehicle, to initiate contract invocation of the smart contract (such as, a right-of-way yielding contract) that corresponds to the vehicle accident event and that is deployed in the consortium blockchain, and execute, in the consortium blockchain, the right-of-way yielding logic that corresponds to the vehicle accident event and that is stated in the smart contract. After detecting that surrounding vehicles actively give the way, the member node device automatically grants a certain amount of right-of-way time to the vehicles that actively give the way, and broadcasts a prompt message “X minutes of right of way are obtained” to these vehicles that actively give the way.

In another implementation, invocation of the smart contract shown above can also be manually triggered by a vehicle driver. After the driver encounters congestion, the driver can perform voice interaction with the vehicle by sending a voice instruction “initiate the right-of-way yielding contract”, and the vehicle broadcasts a prompt message “A following vehicle has an emergent pass need, and requests to use a right lane with a contract reward of X minutes of right of way” to other surrounding vehicles. After detecting that surrounding vehicles actively give the way, the vehicle automatically grants a certain amount of right-of-way time to the vehicles that actively give the way, and broadcasts a prompt message “X minutes of right of way are obtained” to these vehicles that actively give the way.

After invocation of the smart contract is completed, the vehicle serving as a member node device can play a prompt message “A driver who gave the way has already obtained X minutes of right of way” for the driver.

(4) Service Scenario 4

In another service scenario, an online service whose execution needs to be triggered based on the real identity of the vehicle and that is deployed in the consortium blockchain by the operator of the consortium blockchain can be an online reward service that is to be completed in the consortium blockchain based on a detected driving event of entering a planned road section by a vehicle.

The planned road section can be a preferred driving road section that is stated in a smart contract and that is planned by the operator of the consortium blockchain or a third party (for example, a traffic management bureau) interconnected with the consortium blockchain, for example, a congestion dispersion road section actively planned by the traffic management bureau in case of congestion.

In this scenario, the service event can be the “driving event of entering a planned road section” that is related to the vehicle. Correspondingly, service logic that corresponds to the service event and that is stated in the smart contract can be “reward logic that corresponds to the driving event of entering a planned road section by a vehicle”.

For example, the reward logic can be processing logic that a certain number of rewards are granted to the driver after the vehicle actively enters the preferred driving road section. For example, a certain number of points or certain duration of right of way can be automatically delivered to an account of the driver as a reward.

In an implementation, assume that a traffic camera serving as a member node device detects the driving event of entering a preferred driving road section by a vehicle. The traffic camera can broadcast, in the consortium blockchain, the driving event to surrounding member node devices of the traffic camera, such as vehicles, the smart zebra crosswalk, and the traffic lights, to perform consensus processing.

After a consensus is reached, the traffic camera can create a transaction based on the driving event and the collected appearance data of the vehicle, to initiate contract invocation of the smart contract (such as, a traffic guide contract) that corresponds to the driving event and that is deployed in the consortium blockchain, and execute, in the consortium blockchain, the reward logic that corresponds to the driving event and that is stated in the smart contract. After detecting that vehicles actively enter the planned road section, the traffic camera automatically grants a certain number of rewards to drivers of these vehicles, and broadcasts a prompt message “A reward of XXX is obtained” to these vehicles.

In another implementation, invocation of the smart contract shown above can also be manually triggered by a vehicle driver. When the driver encounters congestion and a latest planned road section is broadcast in the consortium blockchain, the driver can perform voice interaction with the vehicle by sending a voice instruction “initiate the traffic guide contract”, and then actively drive to the planned road section to obtain the reward. After detecting a driving event of actively entering a preferred driving road section by a vehicle, the traffic camera can automatically grant a certain number of rewards to the driver, and broadcast a prompt message “You have entered the planned road section and obtained a reward of XXX” to the vehicle.

(5) Service Scenario 5

In another service scenario, an online service whose execution needs to be triggered based on the real identity of the vehicle and that is deployed in the consortium blockchain by the operator of the consortium blockchain can be corresponding service logic that is to be completed in the consortium blockchain based on a detected driving event of entering a planned road section by a vehicle.

In this scenario, the planned road section can be a restricted road section that is stated in a smart contract and that is planned by the operator of the consortium blockchain or a third party (for example, a traffic management bureau) interconnected with the consortium blockchain, for example, a congested road section or a restricted road section.

In this scenario, the service event can be the “driving event of entering a planned road section” that is related to the vehicle. Correspondingly, service logic that corresponds to the service event and that is stated in the smart contract can be “service logic that corresponds to the driving event of entering a planned road section by a vehicle”.

For example, the service logic can be processing logic that the driver is charged a certain number of fees or a certain percentage of normal fees as additional fees besides the normal fees after the vehicle actively enters the restricted road section.

In an implementation, assume that a traffic camera serving as a member node device detects a driving event of entering a restricted road section by a vehicle. The traffic camera can broadcast, in the consortium blockchain, the driving event to surrounding member node devices of the traffic camera, such as vehicles, the smart zebra crosswalk, and the traffic lights, to perform consensus processing.

After a consensus is reached, the traffic camera can create a transaction based on the driving event and the collected appearance data of the vehicle, to initiate contract invocation of the smart contract (such as, a traffic guide contract) that corresponds to the driving event and that is deployed in the consortium blockchain, and execute, in the consortium blockchain, the service logic that corresponds to the driving event and that is stated in the smart contract. After detecting that vehicles actively enter the restricted road section, the traffic camera automatically charges drivers of these vehicles a certain number of fees or a certain percentage of additional fees besides the normal fees, and broadcasts a prompt message “You have entered a restricted road section and already been charged fees of XXX” to these vehicles.

In the previous implementations, examples in which the target entities are vehicles are used to describe in detail the technical solutions of the present specification. It is worthwhile to further note that, in actual applications, the target entities can be other types of entities that can access the blockchain as members, which are not listed one by one in the present specification.

It can be seen from the previous implementations that, on the one hand, because the appearance data of the target entity is easy to collect, the appearance data of the target entity is registered in the distributed database of the blockchain as the identity of the target entity, so that after detecting the service event that corresponds to the target entity, the member node device in the blockchain can rapidly identify, by further collecting the appearance data of the target entity, the target entity that corresponds to the service event, to easily associate the service event with the identity of the target entity.

On the other hand, because the appearance data of the target entity is registered in the distributed database of the blockchain as the identity of the target entity, when creating the transaction based on the appearance data of the target entity and the service event and invoking the smart contract that is published in the blockchain and that corresponds to the service event, the member node device in the blockchain can execute, by using the identity indicated by the appearance data of the target entity, the service logic stated in the smart contract, to easily complete, in the blockchain, service interaction related to the identity of the target entity, thereby improving flexibility and extensibility of the blockchain from a service perspective.

Corresponding to the previous method implementations, the present specification further provides an implementation of a blockchain-based service execution apparatus. The implementation of the blockchain-based service execution apparatus in the present specification can be applied to an electronic device. The apparatus implementation can be implemented by software, hardware, or a combination of hardware and software. Software implementation is used as an example. As a logical apparatus, the apparatus is formed by reading a corresponding computer program instruction in a nonvolatile memory to a memory by a processor of the electronic including the apparatus. In terms of hardware, FIG. 2 is a structural diagram illustrating hardware of an electronic device including the blockchain-based service execution apparatus, according to the present specification. In addition to a processor, a memory, a network interface, and a nonvolatile memory shown in FIG. 2, the electronic device including the apparatus in the implementation usually can further include other hardware based on an actual function of the electronic device. Details are omitted here for simplicity.

FIG. 3 is a block diagram illustrating a blockchain-based service execution apparatus shown in an example implementation of the present specification.

Referring to FIG. 3, a blockchain-based service execution apparatus 30 can be applied to the electronic device shown in FIG. 2, and include a registration module 301, a receiving module 302, and an execution module 303.

The registration module 301 is configured to collect appearance data of a target entity, and register, in a distributed database of a blockchain, the appearance data as an identity of the target entity.

The receiving module 302 is configured to receive a target transaction initiated by a member node device in the blockchain, where the target transaction includes the appearance data of the target entity that is collected by the member node device and a service event that is related to the target entity and that is detected by the member node device.

The execution module 303 is configured to invoke a smart contract that corresponds to the service event, and execute, based on the identity indicated by the appearance data of the target entity, service logic stated in the smart contract.

In the present implementation, an optical medium for solidifying the appearance data of the target entity is sprayed on an outer surface of the target entity; and the registration module 301 is configured to: collect, by using a mounted optical sensor, the appearance data of the target entity that is solidified by the optical medium.

In the present implementation, the optical medium is a nano-optical film.

In the present implementation, the registration module 301 is configured to: store the appearance data in the distributed database of the blockchain to form an association with the identity of the target entity that is registered in the blockchain.

In the present implementation, the blockchain-based service execution apparatus 30 further includes: an update module 304 (not shown in FIG. 3), configured to: when the collected appearance data of the target entity changes, update, based on changed appearance data, the appearance data that is registered in the distributed database of the blockchain, generate a corresponding update record, and store the update record in the distributed database of the blockchain.

In the present implementation, the target entity includes a vehicle, and the member node device includes a public transport device that accesses the blockchain.

In the present implementation, the service event includes a vehicle violation event, and the service logic stated in the smart contract includes violation processing logic that corresponds to the vehicle violation event.

In the present implementation, the service event includes a vehicle accident event, and the service logic stated in the smart contract includes vehicle accident liability determining logic and vehicle accident settlement logic that correspond to the vehicle accident event.

In the present implementation, the service event includes a traffic congestion event, and the service logic stated in the smart contract includes right-of-way yielding logic that corresponds to the traffic congestion event.

In the present implementation, the service event includes a driving event of entering a planned road section by a vehicle, and the service logic stated in the smart contract includes reward logic that corresponds to the driving event of entering a planned road section by a vehicle.

In the present implementation, the service event includes a driving event of entering a planned road section by a vehicle, and the service logic stated in the smart contract includes service logic that corresponds to the driving event of entering a planned road section by a vehicle.

In the present implementation, the blockchain is a consortium blockchain.

For an implementation process of functions and roles of each module in the apparatus, references can be made to an implementation process of a corresponding step in the previous method. Details are omitted here for simplicity.

Because an apparatus implementation basically corresponds to a method implementation, for related parts, references can be made to related descriptions in the method implementation. The previously described apparatus implementation is merely an example. The modules described as separate parts may or may not be physically separate, and parts displayed as modules may or may not be physical modules, may be located in one position, or may be distributed on a plurality of network modules. Some or all of the modules may be selected based on actual needs to achieve the objectives of the solutions in the present specification. A person of ordinary skill in the art can understand and implement the implementations of the present specification without creative efforts.

The system, apparatus, module, or unit illustrated in the previous implementations can be implemented by using a computer chip or an entity, or can be implemented by using a product having a certain function. A typical implementation device is a computer, and the computer can be a personal computer, a laptop computer, a cellular phone, a camera phone, a smartphone, a personal digital assistant, a media player, a navigation device, an email receiving and sending device, a game console, a tablet computer, a wearable device, or any combination of these devices.

Corresponding to the described method implementation, the present specification further provides an implementation of an electronic device. The electronic device includes a processor and a memory configured to store a machine-executable instruction, and the processor and the memory are usually connected to each other by using an internal bus. In another possible implementation, the device may further include an external interface, to communicate with another device or component.

In the present implementation, by reading and executing a machine-executable instruction that is stored in the memory and that corresponds to blockchain-based service execution control logic, the processor is enabled to: collect appearance data of a target entity, and register, in a distributed database of a blockchain, the appearance data as an identity of the target entity; receive a target transaction initiated by a member node device in the blockchain, where the target transaction includes the appearance data of the target entity that is collected by the member node device and a service event that is related to the target entity and that is detected by the member node device; and invoke a smart contract that corresponds to the service event, and execute, based on the identity indicated by the appearance data of the target entity, service logic stated in the smart contract.

In the present implementation, an optical medium for solidifying the appearance data of the target entity is sprayed on an outer surface of the target entity; and by reading and executing a machine-executable instruction that is stored in the memory and that corresponds to blockchain-based service execution control logic, the processor is enabled to: collect, by using a mounted optical sensor, the appearance data of the target entity that is solidified by the optical medium.

In the present implementation, by reading and executing a machine-executable instruction that is stored in the memory and that corresponds to blockchain-based service execution control logic, the processor is enabled to: store the appearance data in the distributed database of the blockchain to form an association with the identity of the target entity that is registered in the blockchain.

In the present implementation, by reading and executing a machine-executable instruction that is stored in the memory and that corresponds to blockchain-based service execution control logic, the processor is enabled to: when the collected appearance data of the target entity changes, update, based on changed appearance data, the appearance data that is registered in the distributed database of the blockchain, generate a corresponding update record, and store the update record in the distributed database of the blockchain.

A person skilled in the art can easily figure out another implementation of the present specification after thinking over the present specification and practicing the present disclosure here. The present specification is intended to cover any variations, uses, or adaptations of the present specification, and these variations, uses, or adaptations follow the general principles of the present specification and include common knowledge or conventional techniques that are not disclosed in the existing technology of the present specification. The specification and the implementations are merely considered as examples, and the actual scope and the spirit of the present specification are pointed out by the following claims.

It should be understood that the present specification is not limited to the precise structures that have been described above and shown in the drawings, and various modifications and changes can be made without departing from the scope of the present specification. The scope of the present specification is limited by the appended claims only.

The described descriptions are merely examples of implementations of the present specification, but are not intended to limit the present specification. Any modification, equivalent replacement, or improvement made without departing from the spirit and principle of the present specification shall fall within the protection scope of the present specification. 

1. A computer-implemented method for a blockchain-based service, comprising: collecting appearance data of a target entity as collected appearance data, the target entity comprising a physical entity capable of accessing, as a member, a blockchain; registering, in a distributed database associated with the blockchain, the appearance data as an identity of the target entity; receiving a target transaction initiated by a member node device in the blockchain, wherein the target transaction comprises the appearance data of the target entity that is collected by the member node device and a service event that is related to the target entity and that is detected by the member node device; invoking a smart contract that corresponds to the service event; and executing, based on the identity indicated by the appearance data of the target entity, service logic stated in the smart contract.
 2. The computer-implemented method of claim 1, wherein collecting the appearance data comprises: collecting, by using a mounted optical sensor and as collected appearance data, the appearance data of the target entity that is solidified by an optical medium applied to an outer surface of the target entity.
 3. The computer-implemented method of claim 2, wherein the optical medium comprises a nano-optical film.
 4. The computer-implemented method of claim 1, wherein registering the appearance data comprises: storing the appearance data in the distributed database of the blockchain to form an association with the identity of the target entity that is registered in the blockchain.
 5. The computer-implemented method of claim 1, further comprising: determining whether changes occur with respect to the collected appearance data of the target entity; in response to determining that changes occur with respect to the collected appearance data of the target entity, updating, based on changed appearance data, the appearance data that is registered in the distributed database of the blockchain; generating a corresponding updated record; and storing the corresponding updated record in the distributed database associated with the blockchain.
 6. The computer-implemented method of claim 1, wherein the target entity comprises a vehicle, and the member node device comprises a public transport device that accesses the blockchain.
 7. The computer-implemented method of claim 6, wherein: the service event comprises a vehicle violation event, and the service logic stated in the smart contract comprises violation processing logic that corresponds to the vehicle violation event; the service event comprises a vehicle accident event, and the service logic stated in the smart contract comprises vehicle accident liability determining logic and vehicle accident settlement logic that correspond to the vehicle accident event; the service event comprises a traffic congestion event, and the service logic stated in the smart contract comprises right-of-way yielding logic that corresponds to the traffic congestion event; the service event comprises a driving event of entering a planned road section by the vehicle, and the service logic stated in the smart contract comprises reward logic that corresponds to the driving event of entering a planned road section by the vehicle; or the service event comprises a driving event of entering a planned road section by the vehicle, and the service logic stated in the smart contract comprises service logic that corresponds to the driving event of entering a planned road section by a vehicle.
 8. A non-transitory, computer-readable medium storing one or more instructions executable by a computer system to perform operations comprising: collecting appearance data of a target entity as collected appearance data, the target entity comprising a physical entity capable of accessing, as a member, a blockchain; registering, in a distributed database associated with the blockchain, the appearance data as an identity of the target entity; receiving a target transaction initiated by a member node device in the blockchain, wherein the target transaction comprises the appearance data of the target entity that is collected by the member node device and a service event that is related to the target entity and that is detected by the member node device; invoking a smart contract that corresponds to the service event; and executing, based on the identity indicated by the appearance data of the target entity, service logic stated in the smart contract.
 9. The non-transitory, computer-readable medium of claim 8, wherein collecting the appearance data comprises: collecting, by using a mounted optical sensor and as collected appearance data, the appearance data of the target entity that is solidified by an optical medium applied to an outer surface of the target entity.
 10. The non-transitory, computer-readable medium of claim 9, wherein the optical medium comprises a nano-optical film.
 11. The non-transitory, computer-readable medium of claim 8, wherein registering the appearance data comprises: storing the appearance data in the distributed database of the blockchain to form an association with the identity of the target entity that is registered in the blockchain.
 12. The non-transitory, computer-readable medium of claim 8, further comprising: determining whether changes occur with respect to the collected appearance data of the target entity; in response to determining that changes occur with respect to the collected appearance data of the target entity, updating, based on changed appearance data, the appearance data that is registered in the distributed database of the blockchain; generating a corresponding updated record; and storing the corresponding updated record in the distributed database associated with the blockchain.
 13. The non-transitory, computer-readable medium of claim 8, wherein the target entity comprises a vehicle, and the member node device comprises a public transport device that accesses the blockchain.
 14. The non-transitory, computer-readable medium of claim 13, wherein: the service event comprises a vehicle violation event, and the service logic stated in the smart contract comprises violation processing logic that corresponds to the vehicle violation event; the service event comprises a vehicle accident event, and the service logic stated in the smart contract comprises vehicle accident liability determining logic and vehicle accident settlement logic that correspond to the vehicle accident event; the service event comprises a traffic congestion event, and the service logic stated in the smart contract comprises right-of-way yielding logic that corresponds to the traffic congestion event; the service event comprises a driving event of entering a planned road section by the vehicle, and the service logic stated in the smart contract comprises reward logic that corresponds to the driving event of entering a planned road section by the vehicle; or the service event comprises a driving event of entering a planned road section by the vehicle, and the service logic stated in the smart contract comprises service logic that corresponds to the driving event of entering a planned road section by a vehicle.
 15. A computer-implemented system, comprising: one or more computers; and one or more computer memory devices interoperably coupled with the one or more computers and having tangible, non-transitory, machine-readable media storing one or more instructions that, when executed by the one or more computers, perform one or more operations comprising: collecting appearance data of a target entity as collected appearance data, the target entity comprising a physical entity capable of accessing, as a member, a blockchain; registering, in a distributed database associated with the blockchain, the appearance data as an identity of the target entity; receiving a target transaction initiated by a member node device in the blockchain, wherein the target transaction comprises the appearance data of the target entity that is collected by the member node device and a service event that is related to the target entity and that is detected by the member node device; invoking a smart contract that corresponds to the service event; and executing, based on the identity indicated by the appearance data of the target entity, service logic stated in the smart contract.
 16. The computer-implemented system of claim 15, wherein collecting the appearance data comprises: collecting, by using a mounted optical sensor and as collected appearance data, the appearance data of the target entity that is solidified by an optical medium applied to an outer surface of the target entity.
 17. The computer-implemented system of claim 16, wherein the optical medium comprises a nano-optical film.
 18. The computer-implemented system of claim 15, wherein registering the appearance data comprises: storing the appearance data in the distributed database of the blockchain to form an association with the identity of the target entity that is registered in the blockchain.
 19. The computer-implemented system of claim 15, further comprising: determining whether changes occur with respect to the collected appearance data of the target entity; in response to determining that changes occur with respect to the collected appearance data of the target entity, updating, based on changed appearance data, the appearance data that is registered in the distributed database of the blockchain; generating a corresponding updated record; and storing the corresponding updated record in the distributed database associated with the blockchain.
 20. The computer-implemented system of claim 15, wherein: the target entity comprises a vehicle, and the member node device comprises a public transport device that accesses the blockchain; and wherein: the service event comprises a vehicle violation event, and the service logic stated in the smart contract comprises violation processing logic that corresponds to the vehicle violation event; the service event comprises a vehicle accident event, and the service logic stated in the smart contract comprises vehicle accident liability determining logic and vehicle accident settlement logic that correspond to the vehicle accident event; the service event comprises a traffic congestion event, and the service logic stated in the smart contract comprises right-of-way yielding logic that corresponds to the traffic congestion event; the service event comprises a driving event of entering a planned road section by the vehicle, and the service logic stated in the smart contract comprises reward logic that corresponds to the driving event of entering a planned road section by the vehicle; or the service event comprises a driving event of entering a planned road section by the vehicle, and the service logic stated in the smart contract comprises service logic that corresponds to the driving event of entering a planned road section by a vehicle. 